<assign name="page_title" value="账号设置" />
<assign name="current_item" value="" />
<include file="Public:header" />
<div id="main">
    <div id="main-header" class="grid page">
        <h2>爱咕噜</h2>
        <h1>账户设置</h1>
    </div>
    <div id="sub-main-header"></div>
    <div id="main-inner" class="account_settings page">
        <h3>欢迎回来，<span id="user-email">{{$profile.email}}</span></h3>
        <div id="account-header" class="grid">
            <div class="col6_18">
                <a href="__APP__/account/edit">修改账号</a>&nbsp;&nbsp;
                <a href="__APP__/account/password">修改密码</a>&nbsp;&nbsp;
                <a href="__APP__/account/login/logout"><b>退出</b></a>
            </div>
            <div class="col12_18 last text_right small">
                <if condition="$messageCount or $noticeCount">
                    你有
                    <gt name="messageCount" value="0">{{$messageCount}} 条私信</gt>
                    <gt name="noticeCount" value="0"><gt name="messageCount" value="0">和</gt> {{$noticeCount}} 条提醒</gt>
                </if>
            </div>  
        </div>
        <hr class="dash" />
        <div class="grid">
            <div id="account-email-notice" class="col10_18">
                <h3>邮件提醒设置</h3>
                <form action='__URL__/saveEmailNoticeConfig' method='post' class="ajaxform">
                    <ul class="lite">
                        <volist name="subscibe" id="vo" key="k">
                            <li><label class="label" for="email{{$k}}"><input type="checkbox" class="checkbox" name="email[]" id="email{{$k}}" value="{{$vo.subscibe_id}}" <present name="vo.email">checked</present> /> {{$vo.description}}</label></li>
                        </volist>
                    </ul>
                    <button class="btn btn_silver fbold" type="submit"><span>保存设置</span></button>
                </form>
                <p class="small gray">你的邮件将定期收到以上勾选的更新提醒</p>
            </div>
            <div id="account-sms-notice" class="col8_18 last hidden">
                <h3>短消息提醒设置</h3>
                <form action='__URL__/saveMobileNoticeConfig' method='post' class="ajaxform">
                    <ul class="lite">
                        <volist name="subscibe" id="vo" key="k">
                            <li><label class="label" for="sms{{$k}}"><input type="checkbox" class="checkbox" name="sms[]" id="sms{{$k}}" value="{{$vo.subscibe_id}}" <present name="vo.mobile">checked</present> /> {{$vo.description}}</label></li>
                        </volist>
                    </ul>
                    <button class="btn btn_silver fbold" type="submit"><span>保存设置</span></button>
                </form>
                <p class="small gray">当前绑定手机: <b>{{$profile.mobilephone}}</b>&nbsp;&nbsp;<a href="__GROUP__/edit">修改</a></p>
            </div>
        </div>
    </div>
</div>
<script>
    Do("validator",function(){
        $("form.ajaxform").validator().submit(function(e){
            var form = $(this);
            if (!e.isDefaultPrevented()) {
                Cute.api.post(form.attr("action"),form.serializeArray(), function(json){
                    if(json.status > 0){
                        new Cute.ui.dialog().suggest(json.info);
                    }else{
                        form.data("validator").invalidate(json.info);
                    }
                });
                e.preventDefault();
            }
        });
    });
</script>
<include file="Public:footer" />
